package demo2;

public class Student {
    public String name = "name: 张三";
    private int age = 10;

    public void fun1(){
        System.out.println("共有方法"+name);
    }
    private void privateFun(){
        System.out.println("私有方法"+age);
    }

    public Student() {
        System.out.println("公开的构造");
    }

    private Student(String name, int age) {
        this.name = name;
        this.age = age;
        System.out.println("私有的构造");
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
